home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
testif.zip
/
TESTIF.DOC
< prev
next >
Wrap
Text File
|
1990-10-25
|
13KB
|
374 lines
Computer Tyme TESTIF * Copyright 1989-90 by Marc Perkel
All Rights Reserved * Version 1.2 * Release Date: 10-25-90
Computer Tyme * 411 North Sherman, Suite 300 * Springfield Mo. 65802
(800) 548-5353 Sales * (417) 866-1222 Voice * (417) 866-1665 Data
This program is part of the Computer Tyme DOS ToolBox.
For $59.95 you can get the rest of the programs.
This program tests the system and returns dos error codes that can be used
to control the execution of .BAT files.
Usage: TestIf VideoMode
Example:
TESTIF VideoMode
IF ERRORLEVEL 7 GOTO MONO
This program tests the system and returns dos error codes that can be used
to control the execution of .BAT files. Error codes range from 0 to 255.
Within this program are commands for reading system parameters and processing
them mathematically into useful error codes.
REM This checks to see if selected screen is MONO or COLOR
TESTIF VideoMode
IF ERRORLEVEL 7 GOTO MONO
:COLOR
....
....
GOTO END
:MONO
....
....
:END
VideoMode is a Testif command that returns the current video mode. If the
current mode is MONO then VideoMode returns a 7.
With this command, if you have both MONO and COLOR screens on your computer,
and you want to set up a .BAT file to bring up a piece of software that is
installed different for mono and COLOR, Testif makes it easy.
Testif has the capibility to test results to see if a command equals a
value.
TESTIF VideoMode = 7
Returns error code 1 if true and 0 if not true. A 1 is always returned to
indicate TRUE and 0 is returned to indicate FALSE. Operators include
=, [], [, ], [=, ]=. Note the square brackets replace the normal greater
than and less than symbols. That is becuase MS-DOS filters these characters
and therefore can't be used.
TESTIF Year = 88 and Month = May
Testif supports all logical operators such as AND, OR, XOR, NOT. Multiple
conditions can be used. Year returns the year part of the system date. Month
returns the month part. May is a constant equal to 5. The error code result
will be 1 for true or 0 for false.
TESTIF MemSize / 10
MemSize returns the total memory size in K. Since this number is usually
larger than 255, (the maximum error code), we devide by 10. On a 640k
machine, the return code is 64. Notice that division is supported. Testif
supports the mathematical operators +, -, *, /, MOD, SHL, SHR, AND, OR, XOR.
All numbers are processed as signed 32 bit integers. It is up to you to
keep the result between 0 and 255 for meaningful results.
TESTIF 5*(9+3)
Interpretation is from left to right. Parentheses can be used to alter this
order. The above example returns 60.
TESTIF FreeSpace(0) ] 4000000
This checks freespace on the current drive (0). Other drives can also be
checked. The result is 1 if more than 4,000,000 bytes are free.
TESTIF FileSize TESTIF.EXE / 1000
This returns the filesize of TESTIF.EXE in K.
To test your formulas, start the line with an @ sign. Testif will print the
return code on the screen.
TESTIF @DosVersion
Return Code: 3
TESTIF Commands:
SUN Constant = 0
MON Constant = 1
TUE Constant = 2
WED Constant = 3
THU Constant = 4
FRI Constant = 5
SAT Constant = 6
JAN Constant = 1
FEB Constant = 2
MAR Constant = 3
APR Constant = 4
MAY Constant = 5
JUN Constant = 6
JUL Constant = 7
AUG Constant = 8
SEP Constant = 9
OCT Constant = 10
NOV Constant = 11
DEC Constant = 12
MONO Constant = 7
CO80 Constant = 3
BW80 Constant = 2
CO40 Constant = 1
BW40 Constant = 0
VideoMode Returns Current Video Mode
VideoPage Returns Current Video Page
ScreenWidth Returns Current Screen Width
Year Returns System Year (88=1988)
Month Returns System Month
Day Returns System Day
DayOfWeek Returns System Day of week (0=SUN)
Hour Returns System Hour
Minute Returns System Minute
Second Returns System Second
WriteVerify Returns if Write Verify is on
DosVersion Returns Dos Version Number
MinorDosVersion Returns Minor Dos Version Number
CurrentDrive Returns Current Drive Number (A: = 0)
Drives Returns Number of Drives
Floppies Returns Number of Floppy Drives
SerialPorts Returns Number of Serial Ports
ParellelPorts Returns Number of Parralel Ports
CapsLock Tells if Caps Lock is on (1=True)
NumLock Tells if Num Lock is on (0=False)
ScrollLock Tells if Scroll Lock is on
MemSize Returns Total Memory Size in K
Random Returns a Random Number from 0 to 255.
SectorsPerCluster(n) Returns Number of Sectors per Cluster (0=Current Drive)
BytesPerSector(n) Returns Number of Bytes per Sector (1=A:)
FreeClusters(n) Returns Number of Free Clusters (2=B:)
TotalClusters(n) Returns Total Number of Clusters (3=C:)
FreeSpace(n) Returns Free Space in Bytes (4=D:)
TotalSpace(n) Returns Total Space in Bytes
Exist <FileName> Tells if File Exists
FileSize <FileName> Returns File Sise in Bytes
FileAttr <FileName> Returns File Attribute
FileDate <FileName> Returns Date and Time as 32 bit Number
Mem(A:B) Returns Byte at A:B
MemW(A:B) Returns Word at A:B
Port(A) Returns Byte at Part A
= True if A = B
[] True if A <> B
[ True if A < B
] True if A > B
[= True if A <= B
]= True if A >= B
+ Returns A + B
- Returns A - B
* Returns A * B
/ Returns A / B
MOD Returns A mod B
AND Returns A and B
OR Returns A or B
XOR Returns A xor B
SHL Returns A shl B (Shift Left)
SHR Returns A shr B (Shift Right)
NOT Returns not A
==============================================================
Information and order forms:
======================================================
The Computer Tyme Dos ToolBox... Makes DOS easier for the novice,
more powerful for the professional.
DIRECTORY MASTER is a powerful hard disk managment utility. It
brings up your hard disk files and allows you to mark selected
files so you can copy them, delete them, or move them. It also
allows you to rename files, change dates, and change attributes.
You can also run programs or set up your function keys to run
programs on selected files.
DOLIST makes being at DOS easier. It gives you full line editing,
like a word processor, for your commands. It also stores commands
so that you can re-execute them. It remembers subdirectories and
allows you to go back to them by pressing the TAB key. It offers
programmable function keys, DOS extensions, multiple execution,
and many more features you have got to have.
PICK DIRECTORY allows you to move through the directory system by
displaying a graphic tree and letting you use your arrow keys to
move around. It also lets you create, delete, rename, and hide
directories.
TEDIT (from SemWare) is a powerful, easy to use full screen
editor.
MARXTSR is a set of memory and TSR management utilities that let
you load and unload TSRs (Terminate and stay resident programs)
from memory. Utilities to list menory allocation and turn TSR's
on and off.
And many more ... Also includes is D, a fancy directory listing
program; WHEREIS, for finding stuff on you hard disk, SORT, MOVE,
FIND, FREE, PIPEDIR, VERSION, and many more.
The Dos Toolbox sells for $59.95.
======================================================
We are also selling QEdit from Semware. QEdit is a professional
editor from Semware. TEdit is a mini version of QEdit. If you
like TEdit, You'll love QEdit.
1-800-548-5353 Order Line